{% extends "../main.html" %}

{% block head %}
{% endblock %}

{% block breadcrumb %}
<nav>
    <ul id="crumbs">
        <li><a href="/">{{ system_title }}</a></li>
        <li>{{ str.rating }}</li>
    </ul>
</nav>
{% endblock %}

{% block content %}

<div id="content">
    <div class="table" style="margin-bottom:10px;">
    {% regroup bubbles|dictsort:"type" by type as grouped %}
    {% for group in grouped %}
        <div class="table_row" style="padding-top:20px;">
            <div class="header_cell">
                {{ group.grouper }}
            </div>
            <div class="header_cell" style="text-align:center;">
                {{ str.reception_period }}
            </div>
            <div class="header_cell" style="text-align:center;">
                {{ str.reception_application_count }}
            </div>
            <div class="header_cell">
            </div>
        </div>
        {% for b in group.list|dictsort:"displayname" %}
        <div class="table_row" alt="{{ b.key }}">
            <div class="table_cell">
                {{ b.displayname|striptags }}
            </div>
            <div class="table_cell" style="text-align:center;">
                {{ b.start_datetime|date:"d.m.Y" }} - {{ b.end_datetime|date:"d.m.Y" }}
            </div>
            <div class="table_cell" style="text-align:center;">
                {{ b.leechers|length }}
            </div>
            <a href="/rating/{{ b.key }}" class="table_cell buttons" style="width:20px; height:25px; background: url('/images/edit.png') center center no-repeat;">
            </a>
        </div>
        {% endfor %}
    {% endfor %}
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $(".table_row").dblclick(function() {
            key = $(this).attr('alt');
            location.href = '/rating/' + key;
            return false;
        });
    });
</script>

{% endblock %}